错误: 无法找到满足要求的webdriver版本(来自版本:)。 | 您所在的位置:网站首页 › system view安装 › 错误: 无法找到满足要求的webdriver版本(来自版本:)。 |
百度翻译此文
有道翻译此文
问题描述
hi i new developer at python i want to use selenium web driver api and use mac pc and i installation web driver library i installation code 'pip install web driver' at pycharm project interpreter but error Error definition look this: Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin/python3.5'. Could not find a version that satisfies the requirement webdriver (from versions: ) No matching distribution found for web driverNote: i use python 3.5 but terminal use 2.7 :( No matching distribution found for web driver Could your help me please Best wishes... 推荐答案This is not very clearly documented, but you cannot install webdriver from pypi but need to install selenium, which then gives you webdriver. sudo pip install seleniumshould do the trick. Or for modern python: sudo python3 -m pip install seleniumYou also need to install geckodriver (for Firefox) or chromedriver (for Chrome and Chromium) and have it in your path, to be able to instanciate a webdriver object. After that things like the below should work: from selenium import webdriver driver = webdriver.Firefox() driver.get("https://stackoverflow.com/questions/34256762/error-could-not-find-a-version-that-satisfies-the-requirement-webdriver-from") 其他推荐答案I encountered a similar problem on Ubuntu. I wanted to install a specific Selenium version, but I was not sure about the exact tag, as tag on Dockerhub differs a bit. So my steps were: 1 Go to https://pypi.org/project/selenium/#files 2 Click Release history tab 3 Find a specific version I needed. In my case it was 4.0.0.a7 4 From Linux Terminal execute: pip install selenium==4.0.0.a7 其他推荐答案you may try the following way, if you do not know the path, use !apt install chromium-chromedriver !pip install selenium !pip install webdriver-manager !apt-get update # to update ubuntu to correctly run apt install !apt install chromium-chromedriver from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager import requests from selenium import webdriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options) driver =webdriver.Chrome('chromedriver',chrome_options=chrome_options) |
CopyRight 2018-2019 实验室设备网 版权所有 |